package com.jwds.digital.bios.business.rpc.feign;

import com.jwds.digital.bios.business.core.infrastructure.dto.feign.ElectricMachineHistoryReqDTO;
import com.jwds.digital.bios.business.core.infrastructure.dto.feign.model.*;
import com.jwds.digital.bios.business.core.infrastructure.vo.feign.FlowBasicRespVO;
import com.jwds.digital.bios.business.rpc.feign.fallback.RealTimeDataFeignFallback;
import com.jwds.jmirror.data.service.api.InstanceDynamicAttrHistoryRespDTO;
import com.jwds.tdc.framework.application.lib.BaseResponse;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @Author hesong
 */
@FeignClient(name = "bios-flow", path = "/flow/real/time/data", fallback = RealTimeDataFeignFallback.class)
public interface RealTimeDataFeign {

    @GetMapping("/flow/plc/data")
    @ApiOperation(value = "流程控制-单个查询")
    BaseResponse<FlowPlcDTO> queryOneFlowPlcData(@RequestParam("deviceCode") String deviceCode);

    @PostMapping("/flow/plc/data/batch")
    @ApiOperation(value = "流程控制-批量查询")
    BaseResponse<Map<String, FlowPlcDTO>> queryFlowPlcDataMap(@RequestBody List<String> deviceCodes);

    @GetMapping("/flow/current/occ/List")
    @ApiOperation(value = "查询当前占用流程")
    BaseResponse<List<FlowBasicRespVO>> currentOccFlowList();


    @GetMapping("/electric/machine")
    @ApiOperation(value = "查询电机最新数据-单个")
    BaseResponse<ElectricMachineDTO> queryElectricMachine(@RequestParam("electricMachineCode") String electricMachineCode);


    @PostMapping("/electric/machine/batch")
    @ApiOperation(value = "查询电机最新数据-批量")
    BaseResponse<Map<String, ElectricMachineDTO>> queryElectricMachineMap(@RequestBody List<String> electricMachineCodes);

    @PostMapping("/electric/machine/history")
    @ApiOperation(value = "电机历史数据查询")
    BaseResponse<Map<String, List<InstanceDynamicAttrHistoryRespDTO>>> queryElectricMachineHistory(@RequestBody ElectricMachineHistoryReqDTO reqDTO);

    @GetMapping("/belt/scale/data")
    @ApiOperation(value = "皮带秤数据-单个查询")
    BaseResponse<BeltScaleDTO> queryOneBeltScaleData(@RequestParam("beltScaleCode") String beltScaleCode);

    @PostMapping("/belt/scale/data/batch")
    @ApiOperation(value = "皮带秤数据-批量")
    BaseResponse<Map<String, BeltScaleDTO>> queryBeltScaleDataMap(@RequestBody List<String> beltScaleCodes);

    @GetMapping("/device/status/data")
    @ApiOperation(value = "设备状态-单个查询")
    BaseResponse<DeviceStatusDTO> queryOneDeviceStatusData(@RequestParam("deviceCode") String deviceCode);

    @PostMapping("/device/status/data/batch")
    @ApiOperation(value = "设备状态-批量")
    BaseResponse<Map<String, DeviceStatusDTO>> queryDeviceStatusDataMap(@RequestBody List<String> deviceCodes);


    @GetMapping("/feeder/status/data")
    @ApiOperation(value = "给料机(料仓)状态-单个查询")
    BaseResponse<FeederStatusDTO> queryOneFeederStatusData(@RequestParam("slotCode") String slotCode);

    @PostMapping("/feeder/status/data/batch")
    @ApiOperation(value = "给料机(料仓)状态-批量")
    BaseResponse<Map<String, FeederStatusDTO>> queryFeederStatusDataMap(@RequestBody List<String> slotCodes);

}
